All Questions
219 questions
5votes
3answers
959views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution? The code is working, but I want to improve it. The challenge I am facing is ...
6votes
2answers
134views
Check whether two Strings are anagrams of each other - then print all anagrams
I should write a CLI through which two Strings can be read in. These two Strings should be checked for whether they are anagrams of each other For both Strings, I should give out all their possible ...
9votes
3answers
344views
Java code to delete all empty folders within a directory
Given the path to a filesystem directory, the task is to delete all empty directories within that root directory. After the process is finished, no empty dir should exist under the root directory (the ...
4votes
3answers
166views
Redouble each occurrence of char recursively, and add n
In following of this question, I would like to have a second review. The exercise is to write a recursive method that takes a String and a ...
3votes
1answer
98views
Double each occurrence of a char recursively
The exercise is to write a recursive method that takes a String and a char parameter and returns a ...
2votes
3answers
553views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
2votes
1answer
60views
Merge Sort with Minimum Sufficient Variables, Verbosity and better Space Complexity
The majority of merge sort implementations searched online are provided with unnecessary variables and code lines. Here is an attempt to reduce that. However, does passing back the subArray as return ...
0votes
1answer
107views
Printing Permutations
Following is a leetcode problem: Given an array nums of distinct integers, return all the possible permutations. You can return all the possible permutations. You can return the answer in any order. ...
0votes
1answer
127views
Given a matrix return true if it contains the Identity matrix (by recursion)
I need to write recursive static method with given 3 parameters the method will return true if the sub matrix with the size of (int size) which the left corner is mat[x][x] is the identity matrix ...
1vote
2answers
734views
size() method for a binary search tree
This is my size method for my binary search tree, that is meant to implement recursion to calculate the tree's size. ...
2votes
1answer
91views
Given an array return true if can be splitted to two groups with same number of cells and same sum
Given an array, the method should return true if you can split it to two groups with the same number of cells and so the sum will be equal. It needs to be done by recursion, and can't change the array ...
-3votes
1answer
752views
method to check if number is ascending order by recursion
method name: public static boolean ascendingNum(int n) method need to be done by recursion and return if the given number is in ascending order from right to left <...
3votes
1answer
436views
Pokemon Soul Link tracker
I've just finished writing a program to help track Pokemon across Soul Links. The goal of the program is to take in the names of the two Pokemon alongside the route that they were caught on. The ...
2votes
1answer
478views
Guess Number Game - Console based game using Java
This game is pretty common for beginner projects. I wrote a version of this before all in Main - so here I challenge myself to recreate it in a more OO style. I wanted to take a more OO approach, so ...
1vote
3answers
185views
Java recursive sort verification function for a linked list
It should return true, if there is no element that follow or the following elements are greater than their predecessors. ...